package com.z.utils.property;

import java.io.*;
import java.net.URLDecoder;
import java.util.Properties;

/**
 * db配置文件
 * 
 * @author wulei
 *
 */
public class KqSqlPropertyUtil {
	//public static PropertyFile property = null;
	//public static Properties datas = null;
	
//	public static Map<String,String> kqSqlMap= new HashMap<String,String>();

	static {
		//property = new PropertyFile("kqSql");
		BufferedReader br = null;
		Properties datas = new Properties();
		try {
			String fileDir = URLDecoder.decode(Thread.currentThread().getContextClassLoader().getResource("").getPath(),"UTF-8");
			//System.out.println(fileDir);
			br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(fileDir+"kqSql.properties")), "UTF-8"));
			datas.load(br);
			//System.out.println(datas.getProperty("finderUserInPost"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static String getValue(String key) {
		String rtn = "";
		try {
			//property = new PropertyFile("kqSql");
			BufferedReader br = null;
			Properties datas = new Properties();
			String fileDir = URLDecoder.decode(Thread.currentThread().getContextClassLoader().getResource("").getPath(),"UTF-8");
			//System.out.println(fileDir);
			br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(fileDir+"kqSql.properties")), "UTF-8"));
			datas.load(br);
			//System.out.println(datas.getProperty("finderUserInPost"));
			//System.out.println(datas.getProperty(key));
			//rtn = new String(property.getString(key).getBytes("ISO-8859-1"),"UTF-8");
			rtn = datas.getProperty(key);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return rtn;
	}

}
